<%--
  Created by IntelliJ IDEA.
  User: 星星在唱歌
  Date: 2022/3/14
  Time: 15:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/statics/js/jquery-3.4.1.js"></script>
</head>
<body>
<h1>点击异步请求</h1>
<button value="提交" id="btn" onclick="toAjax()">提交</button>
<script>
    //发送ajax异步请求
    function toAjax(){
        $.get(
            "/getUsers",  //请求的url路径
            {"id":19,"name":"哈哈哈"}, //请求到控制器的参数
            function (data){ //回调函数
                console.log("data:",data);
                console.log("数据：", data.data);
                console.log("msg:" , data.msg);
                //数据渲染到对应的表格中，展示给用户...
            },"json"  //表示响应的数据格式
        );
    }
</script>
</body>
</html>
